package com.lbx.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @author 吕兵星
 * @date 2020/10/25 12:05
 */
@Controller
public class UserController {
    @GetMapping("/toUserInfo")
    public String toUserInfo(String uname){
        return "userInfo";
    }
    @GetMapping("/toLogout/{uname}")
    public String toLogout(@PathVariable("uname") String uname, HttpServletRequest request){
        HttpSession session = request.getSession();
        session.removeAttribute("uname");
        return "redirect:/toSuccess";
    }
}
